package com.workoutdiary.data;

public class Table {
	
	public static class UserTable {
		public static final String TABLE = "user"; 
		public static final String COLUMN_ID = "id";
		public static final String COLUMN_NAME = "name";
		public static final String COLUMN_SURNAME = "surname";
		public static final String COLUMN_EMAIL = "email";
		public static final String COLUMN_PASSWORD = "password";
		
		public static final String DROP = "DROP TABLE " + TABLE + ";";
		
		public static final String CREATE = "CREATE TABLE " + TABLE + " ("
				+ COLUMN_ID + " AUTOINCREMENT , "
				+ COLUMN_NAME + " varchar(255), "
				+ COLUMN_SURNAME + " varchar(255), "
				+ COLUMN_EMAIL + " varchar(255), "
				+ COLUMN_PASSWORD + " varchar(255)"
				+ ");";
		
		public static final String CREATEH2 = "CREATE TABLE " + TABLE + " ("
				+ COLUMN_ID + " integer AUTO_INCREMENT , "
				+ COLUMN_NAME + " varchar(255), "
				+ COLUMN_SURNAME + " varchar(255), "
				+ COLUMN_EMAIL + " varchar(255), "
				+ COLUMN_PASSWORD + " varchar(255)"
				+ ");";
		
		public static final String INSERT = "INSERT INTO " + Table.UserTable.TABLE + "( "
				+ Table.UserTable.COLUMN_NAME + ", "
				+ Table.UserTable.COLUMN_SURNAME + ", "
				+ Table.UserTable.COLUMN_EMAIL + ", "
				+ Table.UserTable.COLUMN_PASSWORD
				+ " ) " 
				+ " values "
				+ "(?, ?, ?, ?)";
		
		public static final String READ_LOGIN_PASSWORD = "SELECT "
				+ Table.UserTable.COLUMN_ID + ","
				+ Table.UserTable.COLUMN_NAME + ","
				+ Table.UserTable.COLUMN_SURNAME + ","
				+ Table.UserTable.COLUMN_EMAIL + ","
				+ Table.UserTable.COLUMN_PASSWORD
				+ " from " + TABLE + " WHERE "
				+ Table.UserTable.COLUMN_EMAIL + "=? " + " AND "
				+ Table.UserTable.COLUMN_PASSWORD + "=?";
		
		public static final String GET_ALL = "SELECT "
				+ Table.UserTable.COLUMN_ID + ","
				+ Table.UserTable.COLUMN_NAME + ","
				+ Table.UserTable.COLUMN_SURNAME + ","
				+ Table.UserTable.COLUMN_EMAIL + ","
				+ Table.UserTable.COLUMN_PASSWORD
				+ " from " + TABLE;
	}
	
	public static class MCycleRecordTable {
		public static final String TABLE = "mcyclerecord"; 
		public static final String COLUMN_ID = "id";
		public static final String COLUMN_USER_ID = "userid";
		public static final String COLUMN_TIMESTAMP = "timestamp";
		public static final String COLUMN_FASE = "fase";
		public static final String COLUMN_DESCRIPTION = "description";
		
		public static final String DROP = "DROP TABLE " + TABLE + ";";
		
		public static final String CREATE = "CREATE TABLE " + TABLE + " ("
				+ COLUMN_ID + " integer auto_increment , "
				+ COLUMN_USER_ID + " integer , "
				+ COLUMN_TIMESTAMP + " bigint , "
				+ COLUMN_FASE + " integer , "
				+ COLUMN_DESCRIPTION + " varchar "
				+ ");";
		
		public static final String INSERT = "INSERT INTO " + Table.MCycleRecordTable.TABLE + "( "
				+ COLUMN_USER_ID + " , "
				+ COLUMN_TIMESTAMP + " , "
				+ COLUMN_FASE + " , "
				+ COLUMN_DESCRIPTION 
				+ " ) "
				+ " values "
				+ "( ?, ?, ?, ?)";
		
		public static final String GET_ALL = "SELECT "
				+ Table.MCycleRecordTable.COLUMN_USER_ID + ","
				+ Table.MCycleRecordTable.COLUMN_TIMESTAMP + ","
				+ Table.MCycleRecordTable.COLUMN_FASE + ","
				+ Table.MCycleRecordTable.COLUMN_DESCRIPTION + ","
				+ Table.MCycleRecordTable.COLUMN_ID
				+ " from " + TABLE;
	}
	
}
